package com.ylt.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ylt.dao.mysqldb.ShopChatDao;
import com.ylt.entity.XcxEzqCart;
import com.ylt.service.ShopChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhouliang
 * @create 2018-12-03 18:20
 */
@Service
public class ShopChatServiceImpl implements ShopChatService {

    @Autowired
    ShopChatDao shopChatDao;

    @Override
    public List<XcxEzqCart> selectXCX_EZQ_CART(XcxEzqCart resMap) {
        List<XcxEzqCart> userDomains = shopChatDao.selectXCX_EZQ_CART(resMap);
        //PageInfo result = new PageInfo(userDomains);
        return userDomains;
    }

    @Override
    public List<XcxEzqCart> selectExistsItem(Map<String, Object> resMap) {
        List<XcxEzqCart> userDomains = shopChatDao.selectExistsItem(resMap);
        return userDomains;
    }

    @Override
    public Integer putXCX_EZQ_CART(Map<String,Object> resMap) {
        Integer count = shopChatDao.putXCX_EZQ_CART(resMap);
        return count;
    }

    @Override
    public int insert(XcxEzqCart xcxEzqCart) {
        int count = shopChatDao.insert(xcxEzqCart);
        return count;
    }

    @Override
    public PageInfo<Map<String, Object>> selectXCX_EZQ_CARTByPage(XcxEzqCart xcxEzqCart, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List order_line_List = shopChatDao.selectXCX_EZQ_CART(xcxEzqCart);
        PageInfo info = new PageInfo(order_line_List);
        return info;
    }

    @Override
    public int deleteByPrimaryKey(Integer lineId) {
        int count = shopChatDao.deleteByPrimaryKey(lineId);
        return count;
    }

    @Override
    public int clearCart(XcxEzqCart xcxEzqCart) {
        int count = shopChatDao.clearCart(xcxEzqCart);
        return count;
    }

    @Override
    public int updateByPrimaryKeySelective(XcxEzqCart record) {
        int count = shopChatDao.updateByPrimaryKeySelective(record);
        return count;
    }

    @Override
    public int updateByOrderQty(Map<String, Object> resMap) {
        int count = shopChatDao.updateByOrderQty(resMap);
        return count;
    }

    @Override
    public XcxEzqCart selectByPrimaryKey(Integer lineId) {
        XcxEzqCart xcxEzqCart = shopChatDao.selectByPrimaryKey(lineId);
        return xcxEzqCart;
    }

//    @Override
//    public List<Map> getImageInfo(String shopId) {
//
//        List userDomains = shopChatDao.selectImageInfo(shopId);
//        //PageInfo result = new PageInfo(userDomains);
//        return userDomains;
//    }
//    @Override
//    public List<Map> getYlt_news() {
//        List news = shopChatDao.selectYlt_news();
//        //PageInfo pageInfo = new PageInfo(news);
//        return news;
//    }
//
//    @Override
//    public Integer binging_wx_check(Map wxMap) {
//        Integer count = shopChatDao.binding_wx_check(wxMap);
//        return count;
//    }
//
//    @Override
//    public void binging_wx(Map wxMap) {
//        shopChatDao.binding_wx(wxMap);
//    }
//
//    /**
//     *
//     * @param pageNum
//     * @param pageSize
//     * @param cust_id
//     * @param so_zt
//     * @return
//     */
//    @Override
//    public PageInfo<Map> getYlt_orders_header(int pageNum, int pageSize, String cust_id,String so_zt,String pay_state) {
//        PageHelper.startPage(pageNum,pageSize);
//        Map tempMap = new HashMap();
//        tempMap.put("CUST_ID",cust_id);
//        if (so_zt!=null && !so_zt.isEmpty()) {
//            tempMap.put("CXTJARR",so_zt.split(","));
//        }
//        tempMap.put("PAY_STATE",pay_state);
//        List orderList = shopChatDao.selectYlt_orders_header(tempMap);
//        PageInfo info = new PageInfo(orderList);
//        return info;
//    }
//
//    @Override
//    public PageInfo<Map> getYlt_orders_LINE(int pageNum, int pageSize, String b2b_order_number) {
//        PageHelper.startPage(pageNum,pageSize);
//        List order_line_List = shopChatDao.selectYlt_orders_line(b2b_order_number);
//        PageInfo info = new PageInfo(order_line_List);
//        return info;
//    }
//
//    @Override
//    public PageInfo<Map> getYlt_items(Map reqMap) {
//    	PageHelper.startPage(Integer.parseInt(reqMap.get("pageNum").toString()),Integer.parseInt(reqMap.get("pageSize").toString()));
//        List order_line_List = shopChatDao.select_Items(reqMap);
//        PageInfo info = new PageInfo(order_line_List);
//        return info;
//    }
//
//    @Override
//    public Map getYlt_customerInfo(String wx_id) {
//
//        Map tempList = shopChatDao.selectYlt_customerInfo(wx_id);
//        return tempList;
//    }
//
//    @Override
//    public void ylt_product_registration(Map<String, Object> reqMap) {
//        shopChatDao.insert_ylt_product_registration(reqMap);
//    }
//
//    @Override
//    public PageInfo<Map> get_ylt_product_registration(Map reqMap) {
//        PageHelper.startPage(Integer.parseInt(reqMap.get("pageNum").toString()),Integer.parseInt(reqMap.get("pageSize").toString()));
//        List product_List = shopChatDao.get_ylt_product_registration(reqMap);
//        PageInfo info = new PageInfo(product_List);
//        return info;
//    }
//
//    @Override
//    public void ylt_cancle_registration(Map wxMap) {
//        shopChatDao.ylt_cancle_registration(wxMap);
//    }
//
//    @Override
//    public void ylt_signOrder(Map<String, Object> reqMap) {
//        shopChatDao.ylt_signOrder(reqMap);
//    }
//
//    @Scheduled(cron="0 59 23 * * *")
//    public void creatYLT_CUSTOMER_HZ(){
//
//        System.out.println("执行了。。。。。");
//        shopChatDao.creatYLT_CUSTOMER_HZ();
//    }
}
